<?php
namespace Home\Controller;
use Think\Controller;
class VideoController extends PublicController {
      /*视频列表  开发人：张森*/
    public function videolist(){
        $coach = M('coach');
        $video=$coach->join('video ON video.coachid = coach.coachid')->select();
        $this->assign('video',$video);
        $this->display();
    }

     /*删除视频  开发人：张森*/
    public function delete(){
        $id=$_GET['videoid'];
        $video=M('video');
        // $pic=$video->where("videoid=$id")->find();
        // unlink(realpath("./Public/photo/".$pic["pic"]));
        $video=$video->where("videoid=$id")->delete();
        if($video=1){
            $this -> success('删除成功！','');
        }else{
            $this->error('删除失败！','');
        }
    }
    /*获取视频名 开发人：周弈男*/
    public function videoname(){
        $id=$_GET['id'];
        $video=M('video');
        $video=$video->where("videoid=$id")->find();
        $this->ajaxReturn($video);
    }

}